package com.schoolvisitors.enums;

import lombok.Getter;

@Getter
public enum RoomTypeEnum {
    // 实验室
    LAB(1, "实验室"),
    // 会议室
    MEETING(2, "会议室");

    private final Integer code;
    private final String desc;
    RoomTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    public static RoomTypeEnum fromCode(int roomTypeId) {
        for (RoomTypeEnum roomType : values()) {
            if (roomType.getCode() == roomTypeId) {
                return roomType;
            }
        }
        throw new IllegalArgumentException("无效的房间类型代码: " + roomTypeId);
    }

}
